package main

import (
	"fmt"
	"math/rand"
	"time"
)

func multiplication_table_arc() {
	for i := 1; i <= 9; i++ {
		for j := 1; j <= i; j++ {
			fmt.Print(j, " * ", i, " = ", i*j, "\t")
		}
		fmt.Print("\n")
	}
}

func multiplication_table_dsc() {
	for i := 9; i >= 1; i-- {
		for j := 1; j <= i; j++ {
			fmt.Print(j, " * ", i, " = ", i*j, "\t")
		}
		fmt.Print("\n")
	}
}

func get_sum_product() {
	src := rand.NewSource(time.Now().UnixNano())
	gen := rand.New(src)
	var sum_num = 0
	var product = 1
	for i := 1; i < 21; i++ {
		gen1 := gen.Intn(19) + 1
		fmt.Printf("第%d个随机数: %d\n", i, gen1)
		mod := i % 2
		if mod == 0 {
			product *= gen1
		} else {
			sum_num += gen1
		}
	}
	fmt.Println("单数个累加求和为：", sum_num)
	fmt.Println("偶数个累乘求积为：", product)
}

func fibo_number_show() {
	a, b := 1, 1
	fmt.Print(a, b, " ")
	for {
		a, b = b, a+b
		if b >= 100 {
			break
		}
		fmt.Print(b, " ")
	}
}

func main() {
	multiplication_table_arc()
	fmt.Print("\n")
	multiplication_table_dsc()
	fmt.Print("\n")
	get_sum_product()
	fmt.Print("\n")
	fibo_number_show()
}


// 批改意见
// 逻辑正确，思路清晰